<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript" src="../js/axios.js"></script>
	</head>
	<body>
		
			<h1>用户信息</h1>
			
		
		<script type="text/javascript">
			/**
			 * 需求：http://localhost:8080/axios/findAll
			 * 返回：所有用户的数据
			 */
			axios.defaults.baseURL = "http://localhost:8080"
			async function findAll(){
				let{data:result} = await axios.get("/axios/findAll");
				console.log(result);
				document.write("<table border='1px' cellspacing='0' cellpadding='0'>");
				document.write("<tr><th>用户id</th><th>用户昵称</th><th>登录账号</th><th>登录密码</th><th>用户资产</th><th>商店id</th><th>操作</th></tr>")
				for (var i = 0; i < result.length; i++) {
					document.write("<tr>")
					document.write("<td>"+result[i].uid+"</td>")
					document.write("<td>"+result[i].uname+"</td>")
					document.write("<td>"+result[i].uuser+"</td>")
					document.write("<td>"+result[i].upass+"</td>")
					document.write("<td>"+result[i].umoney+"</td>")
					document.write("<td>"+result[i].sid+"</td>")
					document.write("<td>&nbsp;<a href='http://localhost:8080/axios/deleteUser?uid="+result[i].uid+"'>删除</a>&nbsp;<a href='http://localhost:8080/axios/updateUser?uid="+result[i].uid+"'>修改</a>&nbsp;</td>")
					document.write("</tr>")
				}
				document.write("</table>");
			}
			findAll();
		</script>
	</body>
</html>
